﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Foundation;

namespace BusinessEntity
{
    public static class GDocsValidator
    {
        public static void ValidateOnSaveOptions(string lsUsername, string lsPassword)
        {
            if (("" + lsUsername).Trim().Length == 0)
            {
                throw new Exception("Please provide an username.");
            }

            if (("" + lsPassword).Trim().Length == 0)
            {
                throw new Exception("Please provide an password.");
            }
        }

        public static void ValidateOnNewDoc(string lsFilename)
        {
            lsFilename = lsFilename.Trim();

            if (lsFilename.Length > Constant.MaxFilenameLength)
            {
                throw new Exception(string.Format("Filename can only contains {0} characters", Constant.MaxFilenameLength));
            }

            if (lsFilename.Length == 0)
            {
                throw new Exception("Please provide a filename");
            }
        }
    }
}
